import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

export default new Vuex.Store({
  state () {
    return {
      status: "登录成功了",
      count: 0,
    };
  },
  // state: {
  // },
  getters: {
    len (state) {
      return state.status.length
    }
  },
  mutations: {
    changeCount (state, num) {
      state.count += num;
      console.log("mutations执行力,count值为" + state.count);
    },
  },
  actions: {
    delayChangeCount (store, num) {
      setTimeout(() => {
        store.commit("changeCount", num);
      }, 3000);
    },
  },
  modules: {},
});
